package com.sskj.fabi.presenter;

import com.lzy.okrx2.adapter.FlowableBody;
import com.sskj.common.base.HttpData;
import com.sskj.fabi.bean.OrderDetailBean;
import com.sskj.fabi.ui.fragment.OrderRecordFragment;
import com.sskj.lib.bean.PageBean;
import com.sskj.lib.http.JsonConverter;

import java.util.List;

import io.reactivex.Flowable;


public class OrderRecordFragmentPresenter extends BasePresenter<OrderRecordFragment> {

    public Flowable<List<OrderDetailBean>> getData(int page, int size, boolean isBuy) {
        return httpService.getOrderList(page, size, isBuy, null)
                .converter(new JsonConverter<HttpData<PageBean<OrderDetailBean>>>() {
                })
                .adapt(new FlowableBody<>())
                .map(pageBeanHttpData -> pageBeanHttpData.getData().getList());
    }
}
